Add an api to retrieve the model containing a given
item in a flatten listmodel. This is useful when the
individual items in the list don't have backpointers.
gtk_flatten_list_model_new
gtk_flatten_list_model_set_model
gtk_flatten_list_model_get_model
+gtk_flatten_list_model_get_model_for_item
<SUBSECTION Standard>
GTK_FLATTEN_LIST_MODEL
GTK_IS_FLATTEN_LIST_MODEL
return self->model;
}
+
+/**
+ * gtk_flatten_list_model_get_model_for_item:
+ * @self: a #GtkFlattenListModel
+ * @position: a position
+ *
+ * Returns the model containing the item at the given position.
+ *
+ * Returns: (transfer none): the model containing the item at @position
+ */
+GListModel *
+gtk_flatten_list_model_get_model_for_item (GtkFlattenListModel *self,
+ guint position)
+{
+ FlattenNode *node;
+
+ if (!self->items)
+ return NULL;
+
+ node = gtk_flatten_list_model_get_nth (self->items, position, NULL);
+ if (node == NULL)
+ return NULL;
+
+ return node->model;
+}
GDK_AVAILABLE_IN_ALL
GListModel * gtk_flatten_list_model_get_model (GtkFlattenListModel *self);
+GDK_AVAILABLE_IN_ALL
+GListModel * gtk_flatten_list_model_get_model_for_item (GtkFlattenListModel *self,
+ guint position);
+
G_END_DECLS
#endif /* __GTK_FLATTEN_LIST_MODEL_H__ */